﻿@model WebUI.Models.JobPostingViewModel
@{
    ViewBag.Title = "Post a Job - JuicyBasket";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h1>Post a Job</h1>
<div class="mainSection">
    <div class="wizard-title">
        <div class="wizard-step active">1. Create a Job Listing</div>
        <div class="wizard-sp active">»</div>
        <div class="wizard-step">2. Preview</div>
        <div class="wizard-sp"> »</div>
        <div class="wizard-step">3. Pay</div>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
    <div class="mainCol jp">
        @if (!Model.Identity.IsCoLoggedIn)
        {
        <div class="spacer"></div>
        <div><strong>Already have a company account?</strong> <a href="/signin">Sign In</a>. Don't have one? No worries, you'll automatically create one after posting a job.</div>
        }
        <div class="spacer"></div>

        @using (Html.BeginForm("JobPosting", "Co", new { JobToken = Model.JobToken }, FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.HiddenFor(m => m.JobToken)
            <div class="clear"></div>
            <div class="fl left">Job Title<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.TextBoxFor(m => m.Job.Title)
                @Html.ValidationMessageFor(m => m.Job.Title)
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Job Type<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.DropDownListFor(m => m.Job.JobTypeID, Model.JobTypeList)
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Experience<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.DropDownListFor(m => m.Job.JobExpID, Model.JobExpList)
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Location<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.TextBoxFor(m => m.Job.Location)
                @Html.ValidationMessageFor(m => m.Job.Location)
            </div>
            
            <div class="clear"></div>
            <div class="fl left left-tip">&nbsp;</div>
            <div class="fl right right-tip">e.g. "Los Angeles, CA", "London, UK", "Anywhere"</div>
            <div class="smallspacer"></div>
            
            <div class="fl left">&nbsp;</div>
            <div class="fl right">
                @Html.CheckBoxFor(m => m.Job.RelocationOffered) Relocation assistance offered for this position
                <div class="minispacer"></div>
                @Html.CheckBoxFor(m => m.Job.AllowTelecommute) Work can be done from anywhere (i.e. telecommuting)
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Compensation</div>
            <div class="fl right">
                @Html.TextBoxFor(m => m.Job.Compensation)
                @Html.ValidationMessageFor(m => m.Job.Compensation)
            </div>
            <div class="clear"></div>
            <div class="fl left left-tip">&nbsp;</div>
            <div class="fl right right-tip">e.g. Salary, bonus, stock, etc"</div>
            <div class="smallspacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Description<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.TextAreaFor(m => m.Job.Description, new { ID = "desTextArea" })
                @Html.ValidationMessageFor(m => m.Job.Description)
            </div>
            <div class="spacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Job Keywords</div>
            <div class="fl right">
                 @Html.TextBoxFor(m => m.Job.JobKeywords)
                 @Html.ValidationMessageFor(m => m.Job.JobKeywords)
            </div>
            <div class="clear"></div>
            <div class="fl left left-tip">&nbsp;</div>
            <div class="fl right right-tip">Key technologies or roles (up to 5, separated by commas), e.g. "web design, html, css, php" </div>
            <div class="spacer"></div>
            
            <div class="fl left">Job Perks</div>
            <div class="fl right">
                @Html.TextAreaFor(m => m.Job.Perk)
                @Html.ValidationMessageFor(m => m.Job.Perk)
            </div>
            <div class="clear"></div>
            <div class="fl left left-tip">&nbsp;</div>
            <div class="fl right right-tip">
                <span id="perk_totalchars"></span>&nbsp;(Html tag is <em>not</em> allowed)
                <div class="minispacer"></div>
                <div>
                    Sell your position! If you're willing to relocate, mention it here. If you've got great benefits, bonuses, paid trips to conferences, free food, discounts, pet-friendly etc., talk it up.
                </div>
            </div>
            <div class="spacer"></div>
            
            <div class="tabsbottom"></div>
            
            <div class="clear"></div>
            <div class="fl left">How to apply<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.RadioButtonFor(m => m.Job.ApplyViaEmail, true) Apply by this email address: <br/>
                @Html.TextBoxFor(m => m.Job.ApplyEmail)
                @Html.ValidationMessageFor(m => m.Job.ApplyEmail)
                <div class="minispacer"></div>
                <div>- OR -</div>
                <div class="minispacer"></div>
                @Html.RadioButtonFor(m => m.Job.ApplyViaEmail, false) Apply via url below: <br />
                @Html.TextBoxFor(m => m.Job.ApplyUrl)
                @Html.ValidationMessageFor(m => m.Job.ApplyUrl)
            </div>
            <div class="spacer"></div>
            
            <div class="fl left">Instructions</div>
            <div class="fl right">
                @Html.CheckBoxFor(m => m.Job.OnlinePortfolioRequired) Online portfolio required
                <div class="minispacer"></div>
                @Html.CheckBoxFor(m => m.Job.OnlinePDFResumeRequired) Online text/pdf resume required
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="spacer"></div>
            <div class="tabsbottom"></div>
            <div class="fl"><strong style="font-size:18px;">Company Information</strong></div>
            <div class="spacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Company Name<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.TextBoxFor(m => m.Co.Name)
                @Html.ValidationMessageFor(m => m.Co.Name)
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Company Type<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.DropDownListFor(m => m.Co.CoTypeID, Model.CoTypeList)
            </div>
            <div class="minispacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Company URL<span>&nbsp;*</span></div>
            <div class="fl right">
                @Html.TextBoxFor(m => m.Co.CoUrl)
                @Html.ValidationMessageFor(m => m.Co.CoUrl)
            </div>
            <div class="clear"></div>
            <div class="fl left left-tip">&nbsp;</div>
            <div class="fl right right-tip">http or https required</div>
            <div class="spacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Profile Picture</div>
            <div class="fl right">
                <div class="avatar80 fl">
                    @Html.HiddenFor(m => m.AvatarUrl)
                    <img id="avatar-url" class="avatar80" src="@Url.StaticFile(Model.AvatarUrl)" alt="Avatar"/>
                </div>
                <div class="vspacer"></div>
                <div class="fl">
                    <div><input type="file" name="avatar" class="file-input"/></div>
                    <div class="smallspacer"></div>
                    <div>Maximum size of 700k. JPG, GIF, PNG.</div>
                </div>
                @Html.ValidationMessageFor(m => m.Avatar)
            </div>
            <div class="smallspacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Company Location</div>
            <div class="fl right">
                @Html.TextBoxFor(m => m.Co.Location)
                @Html.ValidationMessageFor(m => m.Co.Location)
            </div>
            <div class="smallspacer"></div>
            
            <div class="clear"></div>
            <div class="fl left">Company Description</div>
            <div class="fl right">
                @Html.TextAreaFor(m => m.Co.Description, new { ID = "coDesTextArea" })
                @Html.ValidationMessageFor(m => m.Co.Description)
            </div>
            <div class="spacer"></div>
            <div class="tabsbottom"></div>
            <div class="fr">
                <input type="submit" id="submitJob" name="submitJob" value="Preview your listing →" class="blue-submit" />
            </div>
            
        }
    </div>
    <div class="sideCol">
        <div class="spacer"></div>
        <div class="clear"><img src="/content/images/icon-cc.png"/></div>
        <div>
            All major credit cards accepted. If you have any question, please feel free to <a href="/contact">contact us</a>
        </div>
    </div>
    <div class="clear"></div>
</div>

@section FooterContent
{
    <script type="text/javascript" src="@Url.StaticFile("~/content/tinyMCE/tiny_mce.js", true)"></script>
    <script type="text/javascript">
        $(function () {
            initTinyMCE("desTextArea", 480, 600);
            initTinyMCE("coDesTextArea", 480, 300);

            textAreaCharsRemaining("Job_Perk", "perk_totalchars", 500);

            toggleApplyMethod();
            $("input[name='Job.ApplyViaEmail']").change(function () {
                toggleApplyMethod();
            });
        });

        function toggleApplyMethod() {
            var value = $("input[name='Job.ApplyViaEmail']:checked").val().toLowerCase();
            if (value == "true") {
                $("input[name='Job.ApplyUrl']").val("");
                $("input[name='Job.ApplyUrl']").attr("disabled", "disabled");
                $("input[name='Job.ApplyEmail']").removeAttr("disabled");
            }
            else {
                $("input[name='Job.ApplyEmail']").val("");
                $("input[name='Job.ApplyEmail']").attr("disabled", "disabled");
                $("input[name='Job.ApplyUrl']").removeAttr("disabled");
            }
        }
    </script>
}